package net.mcreator.infinite_storage.procedure;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.item.ItemStack;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.Entity;

import net.mcreator.infinite_storage.ElementsInfiniteStorageMod;

import java.util.function.Supplier;
import java.util.Map;
import java.util.HashMap;

@ElementsInfiniteStorageMod.ModElement.Tag
public class ProcedureInfiniteBagGuiClose extends ElementsInfiniteStorageMod.ModElement {
	public ProcedureInfiniteBagGuiClose(ElementsInfiniteStorageMod instance) {
		super(instance, 50);
	}
	static Map<String, Object> $_dependencies = new HashMap<>();
	public static void executeProcedure(Map<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		String NameAA = "";
		String NameBB = "";
		String NameCC = "";
		String NameDD = "";
		String NameEE = "";
		NBTTagCompound InfiniteBag = entity.getEntityData().getCompoundTag("InfiniteBag");
		NameAA = (String) (("ItemSave") + "" + ((new java.text.DecimalFormat("0").format(InfiniteBag.getDouble("InfiniteBagPage")))));
		NameBB = (String) (("ItemNumSave") + "" + ((new java.text.DecimalFormat("0").format(InfiniteBag.getDouble("InfiniteBagPage")))));
		NameCC = (String) (("ItemMetaSave") + "" + ((new java.text.DecimalFormat("0").format(InfiniteBag.getDouble("InfiniteBagPage")))));
		NameDD = (String) (("ItemNbtSave") + "" + ((new java.text.DecimalFormat("0").format(InfiniteBag.getDouble("InfiniteBagPage")))));
		NameEE = (String) (("ItemName") + "" + ((new java.text.DecimalFormat("0").format(InfiniteBag.getDouble("InfiniteBagPage")))));
		InfiniteBag.setString((NameAA), "");
		InfiniteBag.setString((NameBB), "");
		InfiniteBag.setString((NameCC), "");
		InfiniteBag.setString((NameDD), "");
		InfiniteBag.setString((NameEE), "");
		for (int index0 = 0; index0 < (int) (54); index0++) {
			InfiniteBag.setString((NameAA), ((InfiniteBag.getString((NameAA))) + "" + ((/* @ItemStack */(new Object() {
				public ItemStack getItemStack(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								return ((Slot) ((Map) invobj).get(sltid)).getStack();
							}
						}
					}
					return ItemStack.EMPTY;
				}
			}.getItemStack((int) (index0))).getItem().getRegistryName().toString())) + "" + ("_,_")));
			InfiniteBag.setString((NameBB), ((InfiniteBag.getString((NameBB))) + "" + ((new Object() {
				public int getAmount(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								ItemStack stack = ((Slot) ((Map) invobj).get(sltid)).getStack();;
								if (stack != null)
									return stack.getCount();
							}
						}
					}
					return 0;
				}
			}.getAmount((int) (index0)))) + "" + ("_,_")));
			InfiniteBag.setString((NameCC), ((InfiniteBag.getString((NameCC))) + "" + ((((new Object() {
				public ItemStack getItemStack(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								return ((Slot) ((Map) invobj).get(sltid)).getStack();
							}
						}
					}
					return ItemStack.EMPTY;
				}
			}.getItemStack((int) (index0)))).getMetadata())) + "" + ("_,_")));
			InfiniteBag.setString((NameDD), ((InfiniteBag.getString((NameDD))) + "" + (((new Object() {
				public ItemStack getItemStack(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								return ((Slot) ((Map) invobj).get(sltid)).getStack();
							}
						}
					}
					return ItemStack.EMPTY;
				}
			}.getItemStack((int) (index0))).hasTagCompound() ? (new Object() {
				public ItemStack getItemStack(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								return ((Slot) ((Map) invobj).get(sltid)).getStack();
							}
						}
					}
					return ItemStack.EMPTY;
				}
			}.getItemStack((int) (index0))).getTagCompound() : -1)) + "" + ("_,_")));
			InfiniteBag.setString((NameEE), ((InfiniteBag.getString((NameEE))) + "" + (((new Object() {
				public ItemStack getItemStack(int sltid) {
					if (entity instanceof EntityPlayerMP) {
						Container _current = ((EntityPlayerMP) entity).openContainer;
						if (_current instanceof Supplier) {
							Object invobj = ((Supplier) _current).get();
							if (invobj instanceof Map) {
								return ((Slot) ((Map) invobj).get(sltid)).getStack();
							}
						}
					}
					return ItemStack.EMPTY;
				}
			}.getItemStack((int) (index0))).getDisplayName())) + "" + ("_,_")));
		}
		entity.getEntityData().setTag("InfiniteBag", InfiniteBag);
	}
}
